package schema

import (
	"entgo.io/ent"
	"entgo.io/ent/dialect/entsql"
	"entgo.io/ent/schema"
	"entgo.io/ent/schema/field"
	"private-domain-overseas-service/pkg/status/bizadmin"
	"time"
)

// AdminRouter holds the schema definition for the MallFans entity.
type AdminRouter struct {
	ent.Schema
}

// Fields of the AdminRouter.
func (AdminRouter) Fields() []ent.Field {
	return []ent.Field{
		field.Int64("admin_router_menu_type").Default(bizadmin.TypeMenu).Comment("菜单类型，directory、目录,menu、菜单"),
		field.String("admin_router_menu_name").Comment("菜单名称"),
		field.Int64("admin_router_icon_type").Default(bizadmin.SysIcon).Comment("图标类型，1、系统图标,2、自定义图标"),
		field.String("admin_router_icon").Optional().Comment("图标标识"),
		field.String("admin_router_route_name").Comment("路由名称(必须唯一)"),
		field.String("admin_router_route_path").Comment("路由路径"),
		field.String("admin_router_component").Comment("组件路径"),
		field.String("admin_router_path_param").Optional().Comment("路径参数"),
		field.Int64("admin_router_status").Default(bizadmin.StatusEnabled).Comment("状态，enabled、启用,disabled、禁用,banned、禁止"),
		field.String("admin_router_active_menu").Optional().Comment("激活菜单的路由名称"),
		field.Int64("admin_router_hide_in_menu").Default(bizadmin.NotHide).Comment("是否在菜单中隐藏"),
		field.Int64("admin_router_pid").Default(0).Comment("父级ID"),
		field.Int64("admin_router_sequence").Comment("排序序号"),
		field.Int64("admin_router_order").Comment("排序"),
		field.String("admin_router_i18n_key").Optional().Comment("国际化键名"),
		field.Int64("admin_router_keep_alive").Default(bizadmin.NotCache).Comment("是否缓存"),
		field.Int64("admin_router_constant").Default(bizadmin.NotConstant).Comment("是否常量路由"),
		field.String("admin_router_href").Optional().Comment("外部链接"),
		field.Int64("admin_router_multi_tab").Default(bizadmin.NotMultiTab).Comment("是否支持多标签页"),
		field.Int64("admin_router_system_type").Default(bizadmin.TypeAdvance).Comment("系统类型，1、普通用户可有，2、管理员可有"),
		field.Int64("is_delete").Default(bizadmin.NotDelete).Comment("是否删除，1、未删除,2、表示删除"),
		field.Time("create_at").Immutable().Default(time.Now).Comment("创建时间"),
		field.Time("update_at").Default(time.Now).Comment("更新时间"),
		field.Time("delete_at").Optional().Comment("删除时间"),
	}
}

func (AdminRouter) Annotations() []schema.Annotation {
	return []schema.Annotation{
		entsql.WithComments(true),
		schema.Comment("后台路由表"),
	}
}
